package com.toycloud.system.service.impl.business;

import java.util.List;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.toycloud.business.dto.params.business.FeedbackProductVersionManagerDetailParams;
import com.toycloud.business.dto.results.CommonResult;
import com.toycloud.common.core.utils.DateUtils;
import com.toycloud.system.domain.business.FeedbackProductParamManagerDetail;
import com.toycloud.system.domain.business.FeedbackProductVersionManagerDetail;
import com.toycloud.system.mapper.business.FeedbackProductVersionManagerDetailMapper;
import com.toycloud.system.service.business.IFeedbackProductVersionManagerDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 产品版本管理关联Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-18
 */
@Service
public class FeedbackProductVersionManagerDetailServiceImpl implements IFeedbackProductVersionManagerDetailService
{
    @Resource
    private FeedbackProductVersionManagerDetailMapper feedbackProductVersionManagerDetailMapper;

    /**
     * 查询产品版本管理关联
     * 
     * @param id 产品版本管理关联主键
     * @return 产品版本管理关联
     */
    @Override
    public FeedbackProductVersionManagerDetail selectFeedbackProductVersionManagerDetailById(Long id)
    {
        return feedbackProductVersionManagerDetailMapper.selectFeedbackProductVersionManagerDetailById(id);
    }

    /**
     * 查询产品版本管理关联列表
     * 
     * @param feedbackProductVersionManagerDetailParams 产品版本管理关联
     * @return 产品版本管理关联
     */
    @Override
    public CommonResult<List<FeedbackProductVersionManagerDetail>> selectFeedbackProductVersionManagerDetailList(FeedbackProductVersionManagerDetailParams feedbackProductVersionManagerDetailParams)
    {
        PageHelper.startPage(feedbackProductVersionManagerDetailParams.getCurrent(), feedbackProductVersionManagerDetailParams.getPageSize());
        List<FeedbackProductVersionManagerDetail> feedbackProductVersionManagerDetails = feedbackProductVersionManagerDetailMapper.selectFeedbackProductVersionManagerDetailList(feedbackProductVersionManagerDetailParams);
        Page<FeedbackProductVersionManagerDetail> feedbackProductVersionManagerDetailsPage = (Page<FeedbackProductVersionManagerDetail>) feedbackProductVersionManagerDetails;
        return CommonResult.Success((int) feedbackProductVersionManagerDetailsPage.getTotal(), feedbackProductVersionManagerDetails);
    }

    /**
     * 新增产品版本管理关联
     * 
     * @param feedbackProductVersionManagerDetail 产品版本管理关联
     * @return 结果
     */
    @Override
    public int insertFeedbackProductVersionManagerDetail(FeedbackProductVersionManagerDetail feedbackProductVersionManagerDetail)
    {
        feedbackProductVersionManagerDetail.setCreateTime(DateUtils.getNowDate());
        return feedbackProductVersionManagerDetailMapper.insertFeedbackProductVersionManagerDetail(feedbackProductVersionManagerDetail);
    }

    /**
     * 修改产品版本管理关联
     * 
     * @param feedbackProductVersionManagerDetail 产品版本管理关联
     * @return 结果
     */
    @Override
    public int updateFeedbackProductVersionManagerDetail(FeedbackProductVersionManagerDetail feedbackProductVersionManagerDetail)
    {
        feedbackProductVersionManagerDetail.setUpdateTime(DateUtils.getNowDate());
        return feedbackProductVersionManagerDetailMapper.updateFeedbackProductVersionManagerDetail(feedbackProductVersionManagerDetail);
    }

    /**
     * 批量删除产品版本管理关联
     * 
     * @param ids 需要删除的产品版本管理关联主键
     * @return 结果
     */
    @Override
    public int deleteFeedbackProductVersionManagerDetailByIds(Long[] ids)
    {
        return feedbackProductVersionManagerDetailMapper.deleteFeedbackProductVersionManagerDetailByIds(ids);
    }

    /**
     * 删除产品版本管理关联信息
     * 
     * @param id 产品版本管理关联主键
     * @return 结果
     */
    @Override
    public int deleteFeedbackProductVersionManagerDetailById(Long id)
    {
        return feedbackProductVersionManagerDetailMapper.deleteFeedbackProductVersionManagerDetailById(id);
    }
    @Override
    public int deleteFeedbackProductVersionManagerDetailByParentid(String id)
    {
        return feedbackProductVersionManagerDetailMapper.deleteFeedbackProductVersionManagerDetailByParentid(id);
    }
}
